# 实现异步请求
# 代表消息中间键，消息接受， 消息分发

# 创建celery对象

import time

from celery import Celery

backend = "redis://127.0.0.1:6379/1"
broker = "redis://127.0.0.1:6379/2"

app = Celery("test", backend=backend, broker=broker)

@app.task
def send_emall(name):
    print(f"向{name}开始发送emall")
    time.sleep(5)
    print(f"向{name}发送emall结束")
    return "ok"


@app.task
def send_msg(name):

    print(f"向{name}开始发送msg")
    time.sleep(5)
    print(f"向{name}发送msg结束")
    return "ok"